﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Text;
using DataHelper;

//计件之产品
namespace DAL
{
   public class JjProdDao
    {
        public bool Update(SortedDictionary<string, string> sdList)
        {
            return new BuiltSQL().UpdateTable("Wage_JjProducts", sdList);
        }
        public bool Insert(SortedDictionary<string, string> sdList)
        {
            return new BuiltSQL().InsertTable("Wage_JjProducts", sdList);
        }
        public bool Delete(string proCode)
        {
            return SQLHelper.ExecuteSqlWithTransaction("Delete from Wage_JjProducts Where ProCode='" + proCode + "'");
        }
        public DataTable GetOneInfo(string proCode)
        {
            return SQLHelper.ExecuteSqlGetDrToDt("select * from Wage_JjProducts Where ProCode='" + proCode + "'");
        }
        public bool IsExist(string proCode)
        {
            DataTable dt = GetOneInfo(proCode);
            if (dt.Rows.Count > 0)
                return true;
            else
                return false;
        }
        public DataTable GetLists(string serWord, string statu)
        {
            string strSQL = " Select * from Wage_JjProducts Where ([Name] like '%" + serWord + "%' OR  ProModel like '%" + serWord + "%' OR ProCode like '%" + serWord + "%') and Statu='"+statu+"'";
            return SQLHelper.ExecuteSqlGetDrToDt(strSQL);

        }
        public DataTable GetLists()
        {
            string strSQL = " Select [Name],ProCode as ID from Wage_JjProducts Where  Statu='Y'";
            return SQLHelper.ExecuteSqlGetDrToDt(strSQL);

        }
    }
}
